package de.unidue.masterproject.plugin.classes_literaturplugin;



import com.j256.ormlite.field.DatabaseField;

import de.unidue.masterproject.generalmodel.PersistentEntity;

public class Literature extends PersistentEntity {
	
	@DatabaseField(generatedId = true)
	private int id;
	@DatabaseField
	private String author;
	@DatabaseField
	private int year;
	@DatabaseField
	private String title;
	@DatabaseField
	private String comment;
	
	protected Literature(String author, int year, String title, String comment){
		this.author = author;
		this.year = year;
		this.title = title;
		this.comment = comment;
	}
	
	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getAuthor() {
		return author;
	}
	
	public void setAuthor(String author) {
		this.author = author;
	}
	
	public int getYear() {
		return year;
	}
	
	public void setYear(int year) {
		this.year = year;
	}
	
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}
	
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	public String toString(){
		String s = author +" ("+year+"): " + title;
		
		if(s.length()>51){
			s = s.substring(0, 50)+"...";
		}
		
		return s;
	}
	
	public Literature(){};
	
}
